package com.asiainfo.exec.task;

import com.alibaba.fastjson.JSON;
import com.asiainfo.exec.args.CommitDataArgs;
import com.asiainfo.exec.core.TaskRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * 提交数据例子
 */
@Service("commit")
public class CommitDataTask implements TaskRunner<CommitDataArgs> {

    private final static Logger LOGGER = LoggerFactory.getLogger(CommitDataTask.class);

    @Override
    public void run(CommitDataArgs args) throws Exception {
        LOGGER.info("开始运行Commit任务 传入参数: {}", JSON.toJSONString(args));
        if (args.isCommitUser()) {
            LOGGER.info("==========> 开始提交用户数据 <===========");
            Thread.sleep(10000L);
            LOGGER.info("==========> 完成提交用户数据 <===========");
        }
        LOGGER.info("运行Commit任务完成");
    }

}
